﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118642285";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCfOqJHLtvDP4lGKLAeY4sh/CL1FYEx3qWovJ5Kh4+a+MFrNsuksyngM0edQ57KMuc7Pp0t/10rLZ5hieVvMkdYrzNkMcQVAatAws0g7FzMDhUvqzy4i3kwBbOCRJoSvf6Xw2WM6sSLIZG9xKgNdEFLUUH698quJ8VhOl/3VRcxqqmJ+bf10w3A2MTJnBqTnzDrEVuDY1jUkTB+qGFko/1ZKvelnKvuK7vHnzfcqK+5Ur/JgLt71gfsQGq0mAH7bNfDoHr4BNEKI2213LMLdAzpX4YO0gAr74Se+f8M8bRFLdwC7KFVySpG9RZ1GfcDgNvqBvGdNWMAYe2S4n7KVIGDAgMBAAECggEAXWu2WFNKxuRZMxueMUYwFHFtRSQn182MnlKEALBGdiMqwC+3DVu83vjXNJK+8F0rQ5w59gnUbQfn28xfG32BVKv+V/PG2phPFMD2PzHORD6i+YPbLV9Pa/h8WJrNVt+4JuySgTogtIyuiIuAGdyyjnEPaCLH/KQC70ejlGaNJCrSedWjpi2/l8aJS0CEC6iDPiPEhftqB66ZSWxcl2z6zUYN4A2sonnVGhWwTdwQQdxHAIwZZ5RN6cn6LqITxWMJi9Nlv+zA57EmhcOzT/SJbNcgj4VfatyLMRaXkgEwGMLbmojAyT5TVZPk0smkY/g3P9Ztdj9xo+1C873KMjmc8QKBgQDa++4NxWuzCb91ZLPTbHvCF95HeH2ganqy+cTbDs+jnQJDyxoUeAhYb/scMy8cFn+gk4upIuPky2oXc3y5cUZ6iU1gBGVEk6pGwuEvPLCfFcMDo42Mpch8ruupU4NyIDhNFASIkzBTfY0tzVA7mtjBsCbk+c9ieb/1gGWvYl4LKwKBgQC6JO5alSrQ98/jHo/hSXnKzh6Z34dYey5TVcDzWGHeIzCVnO2hriQHr0Qc6qwrMfv9EhPe/27vUrfmLolC4lIZkLXUkCAXqV837w890qp3XxUbSqoadD/1Ib6ptyl4FGoxv2n7aZgweZVurfaf5QVRMwotlwrKZTRUK31Ihm/XCQKBgQCSObwCchuymAXC7BWwTjZtquaArxKkNbXtIR+0bzVzuXozrsGhfW2FMHFrqToB9XwPy7ZsoKGwu6wCMNnOMrevR1Plk8nTew8u5R7dHheKg0uPeH0it+kiaONwVBXn9V/jCETmtfKFLcdCGGFFC+dFnsy6BZ3X0hi+ZJiB/ptxtQKBgQCS19eAdfRU7Wl+DfoLC1+c8YWKdZ/b2TDuZNPWJH7wMmp9XFLKHQonVcgx158CZGgZeE1cubzV5zdTyppVvRxvNo16pkfq4p5PDbPEXZBEoymPYhNW0yYxRvGWCPwZ0mED5bDBuMdqVj/gFDReZtkO+WiqFmFY0QW68KPgts07oQKBgBfHxZFcudZTX4bwRB02Vq60fzuKa3df8DZA5NJ1n2pcPm3P4VeqqJW4aJkt1YtVwYK/2SSaCj9ZLQkXUqfKlTwWFsNf3xxR8QmfnxCIpAGsw+rsaBZQh5za8g3ZkTZ0ibuHK6t2aAFBp5+V9vSpXqjNqJbC84kCoTKVfYUQSXpZ";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvJIG5ElJK5fjagIrBCgx10amhraQYInip5oe+hL73jPtnrvGTwpuW77rooiHsCg2rjMg4QvomA23B2QV/m5Wg0FOE9tFfMPPWLSst1jf3M/lhBgXsTxGw5DUoCDnvDoN8d80lC2H2ChpFGCOi9IGilAsLyG6QMrmmzcIfSQ/NXQxGht3HkaVa1pPYYEh2jDVtYesA85ysFIEayRS3Psc+xof91VOUuA3hF7NrupGXR1BKcRpZcVSDIKQo9EQf8uJaR5bLPzHD0OuKa+uBr/TYuWyDNTqTyXRF9o4Pi2YOkV5/QWnmEhKbJ19jK4V37UKNOiqztzchkUzv3uitli+NQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

